import React from 'react';
import ReactDom from 'react-dom';

class List extends React.Component{
    constructor(props){
        super(props);
        this.state = {anum : 0,bnum:0};
        this.chuli = this.chuli.bind(this);
    }
    chuli(type){
        if(type==='a'){

            this.setState({anum:++this.state.anum});
        }else if(type==='b'){

            this.setState({bnum:++this.state.bnum});
        }
    }
    render(){
        return <ul>
            <li>{this.state.anum}</li>
            <li onClick={()=>{this.chuli('a');}}>aaaa</li>
            <li>{this.state.bnum}</li>
            <li onClick={()=>{this.chuli('b');}}>bbbb</li>
        </ul>
    }
}
ReactDom.render(<List/>, document.querySelector('#aaa'));
export default List;
